package com.yangyang.androidconnect;

import android.content.Context;

import com.yanzhenjie.andserver.AndServer;
import com.yanzhenjie.andserver.Server;

import java.util.HashSet;
import java.util.concurrent.TimeUnit;

public class MyHttpServer {
    private Context context;
    private HashSet<String> tokenSet = new HashSet<>();
    Server server;

    public MyHttpServer(int port, Context context) {
        this.context = context;
        server = AndServer.webServer(context)
                .port(port)
                .timeout(10, TimeUnit.SECONDS)
                .build();

    }

    public void start() {
        server.startup();
    }

    public void stop() {
        server.shutdown();
    }

}
